package cn.edu.scau.cmi.chenyaoquan.factory;

import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.control.TextArea;
import javafx.scene.control.TextField;

public class FactoryController {
	  @FXML
	    private TextField meatTextField;

	    @FXML
	    private TextArea meatTextArea;

	    @FXML
	   public  void getMeat(ActionEvent event) {

	    	MeatFactory meatFactory = null;
	    	if(meatTextField.getText().compareTo("pork")==0) {
	    		meatFactory = new PorkMeatFactory();
	    	}
	    	if(meatTextField.getText().compareTo("beef")==0) {
	    		meatFactory = new BeefMeatFactory();
	    	}
	    	if(meatTextField.getText().compareTo("chicken")==0) {
	    		meatFactory = new ChickenMeatFactory();
	    	}
	    	Meat meat =  meatFactory.getMeatObj();	
	    	meatTextArea.appendText(meat.getInfo());
	 
	    }
}
